package com.briup.recognition.web.controller;


import com.briup.recognition.bean.RolePrivilege;
import com.briup.recognition.service.RolePrivilegeService;
import com.briup.recognition.utils.Message;
import com.briup.recognition.utils.MessageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: 冯琼华
 * @Date: 2021/03/29/15:20
 * @Description:
 */

@RestController
@RequestMapping("/rolePrivilege")
public class RolePrivilegeController {

    @Autowired
    private RolePrivilegeService rolePrivilegeService;

    @GetMapping("query")
    public Message query(){
        List<RolePrivilege> list = rolePrivilegeService.query();
        return MessageUtil.success(list);
    }

    @PostMapping("/saveOrUpdate")
    public Message saveOrUpdate(RolePrivilege rolePrivilege){
        rolePrivilegeService.saveOrUpdate(rolePrivilege);
        return  MessageUtil.success("操作系统");
    }

    @DeleteMapping("/deleteById")
    public Message deleteById(long id){
        rolePrivilegeService.deleteById(id);
        return MessageUtil.success("删除成功");
    }

}
